package org.whuims.io;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class CFileWriter {
	String path = "";
	String charset = "utf8";

	public CFileWriter(String path, String charset) {
		super();
		this.path = path;
		this.charset = charset;
	}

	public CFileWriter(String path) {
		super();
		this.path = path;
	}

	public void writerFile(String content, boolean append) {
		try {
			BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
					new File(path), append), charset));
			writer.append(content);
			writer.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
